/*
    以文件流的形式读取数据
 */
const fs = require('fs')
var fileReadStream = fs.createReadStream('input.txt');
var str = "";
var count = 0;
fileReadStream.on('data',(chunk) => {
    count++;
    str+=chunk;//保存分段读取的数据
});

fileReadStream.on('end',(chunk)=>{
    console.log('读取结束')
    console.log(count);
    console.log(str)
})
fileReadStream.on("error", (error)=>{
     console.log(error)
})